# Adds skinning support when included in a controller.
# 
# This works by overriding the controller's render method so that a template
# from the current skin is used (if the skin template is present, otherwise
# the default template is used as normal).
# 
# Note that by default this also adds :layout => 'blog' to every render
# (although you can override this by specifying a different :layout).
module Skinning

  # Render the action using the site's skin.
  def render(options = {})
    unless options[:nothing] or options.has_key? :file
      options[:file] = current_skin.template(params[:controller],
        options[:template] || options[:action] || params[:action])
    end

    options[:layout] = 'blog' unless options.has_key? :layout
    
    super options
  end
  
end